let somebool = ref false
let somestr = ref ""
let someint = ref 0

let images = ref (""::[])

let usage = "usage: " ^ Sys.argv.(0) ^ " [-b] [-s string] [-d int]"


let speclist = [
	("-b", Arg.Unit (fun () -> somebool := true)),
	("-s", Arg.String (fun s -> somestr := s)),
	("-d", Arg.Int (fun d -> someint := d))
]

let addToList x =
	images := x::!images

(******** appel à la boucle principale et aux principaux composants ********)
let _ =
	(*if ((Array.length Sys.argv) > 1) then
		let myImage = Sys.argv.(0) in print_endline myImage;*)
	if (Array.length Sys.argv > 1) then
	begin
		Array.iter (fun x -> addToList x) Sys.argv;
		let elt = (List.nth !images 2) in
		begin
		print_endline ("> " ^ elt);
		if (elt == "--help" ||
		elt == "-help") then
		print_endline "./lmtw.bin [-string map]"
		end;
		print_endline (">> Traitement en ligne de commande\n\n" ^ elt);
	end;

	(*Arg.parse
		speclist
		(fun x -> raise (Arg.Bad ("Bad Argument : " ^ x)))
		usage;
	Printf.printf "%b %d '%s' \n" !somebool !someint !somestr;*)

	Sdlttf.init ();
	Interface.main_interface ();
	GMain.main ()
